﻿
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <unistd.h>



/*
 * ./dac_zmq_test /dev/zmq_dac  

 */

int main(int argc, char **argv)
{

	int fd, ret;
	unsigned short data = 0;


	if (argc != 2)
	{
		printf("Usage: %s /dev/zmq_dac  \n", argv[0]);
		return -1;
	}
	
	fd = open(argv[1], O_RDWR);
	if (fd == -1)
	{
		printf("Open %s err.\n", argv[1]);
		return -1;
	}
	
	while (1)
	{
		write(fd, &data, 2);
		data += 50;
		sleep(1);
	}

	close(fd);
	return 0;
}


